package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author liuchun
 * @since 2024-09-05
 */
@Api(tags = "点赞或取消点赞")
@RestController
@RequestMapping("/likes")
public class LikedRecordController {

    @Autowired
    private ILikedRecordService recordService;

    @ApiOperation("点赞或者取消赞接口")
    @PostMapping
    public void addLikeRecord(@RequestBody @Validated LikeRecordFormDTO likeRecordFormDTO){
        recordService.addLikeRecord(likeRecordFormDTO);
    }


    @ApiOperation("批量查询业务点赞状态")
    @GetMapping("/list")
    public Set<Long> listLikeRecord(@RequestParam("bizIds") List<Long> bizIds){
        return recordService.listLikeRecord(bizIds);
    }
}
